#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# @author: jianping.gao
# @date: 2023-09-01 14:01:55
# @desc:
from typing import List
from fastapi import APIRouter
from loguru import logger
from sqlalchemy.orm import Session
from fastapi import Depends
from app.models.page import Page
from app.providers.database_provider import get_db
from app.models.dto.project_sale_strategy import ProjectSaleStrategyQueryReq, ProjectSaleStrategyReq,ProjectSaleStrategyResp
from app.models.result import Result
from app.service.project_sale_strategy import ProjectSaleStrategyService

router = APIRouter( prefix="/saleStrategy/panel")

@router.post("/firstLaunchProject",response_model=Result[List[ProjectSaleStrategyResp]],summary="事业部首发项目看版")
async def first_launch_peoject_panel(request: ProjectSaleStrategyQueryReq,db: Session = Depends(get_db)):
    request.saleStrategyCode=0
    request.regionCodeList=[]
    list=ProjectSaleStrategyService().get_sub_project_panel_list(request,db)
    return Result.success(data=list)

@router.post("/mainPushProject",response_model=Result[List[ProjectSaleStrategyResp]],summary="大区主推项目看版")
async def main_push_peoject_panel(request: ProjectSaleStrategyQueryReq,db: Session = Depends(get_db)):
    request.saleStrategyCode=1
    request.divisionCodeList=[]
    list=ProjectSaleStrategyService().get_sub_project_panel_list(request,db)
    return Result.success(data=list)

@router.get("/groupMotorizedProject",response_model=Result[List[ProjectSaleStrategyResp]],summary="集团机动项目看版")
async def group_motorized_peoject_panel(db: Session = Depends(get_db)):
    request = ProjectSaleStrategyQueryReq()
    request.saleStrategyCode=2
    list=ProjectSaleStrategyService().get_sub_project_panel_list(request,db)
    return Result.success(data=list)

@router.get("/toFirstLaunchProject",response_model=Result[List[ProjectSaleStrategyResp]],summary="即将首发项目看版")
async def to_first_launch_project_panel(db: Session = Depends(get_db)):
    request = ProjectSaleStrategyQueryReq()
    list=ProjectSaleStrategyService().get_to_first_launch_project_panel(request,db)
    return Result.success(data=list)